﻿namespace h7
{
    public abstract class Animal
    {
        private string _name;

        public Animal(string name)
        {
            _name = name;
        }

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        public abstract void Enjoy();
    }

    public class Cat : Animal
    {
        private string _eyesColor;

        public Cat(string name, string eyesColor) : base(name)
        {
            _eyesColor = eyesColor;
        }

        public string EyesColor
        {
            get { return _eyesColor; }
            set { _eyesColor = value; }
        }

        public override void Enjoy()
        {
            Console.WriteLine($"猫，名字叫{Name}，让这只{_eyesColor}眼睛的猫笑一笑");
        }
    }

    // 狗类，继承自Animal
    public class Dog : Animal
    {
        private string _furColor;

        public Dog(string name, string furColor) : base(name)
        {
            _furColor = furColor;
        }

        public string FurColor
        {
            get { return _furColor; }
            set { _furColor = value; }
        }

        public override void Enjoy()
        {
            Console.WriteLine($"狗，名字叫{Name}，让这只{_furColor}毛发的狗叫一叫");
        }
    }

    public class Lady
    {
        private string _name;
        private Animal _pet;

        public Lady(string name, Animal pet)
        {
            _name = name;
            _pet = pet;
        }

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        public Animal Pet
        {
            get { return _pet; }
            set { _pet = value; }
        }

        public void MyPetEnjoy()
        {
            Console.Write($"{_name}，养了一只");
            _pet.Enjoy();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            Animal cat = new Cat("咪咪", "蓝色");
            Lady msZhang = new Lady("张女士", cat);
            msZhang.MyPetEnjoy();

            Animal dog = new Dog("旺财", "黄色");
            Lady msWang = new Lady("王女士", dog);
            msWang.MyPetEnjoy();
        }
    }
}
